import request from '@/request/request.js';

// 任务选择
export const taskSelection = (data) => {
	return request({
		url: `/org/app/sub/plan/app/task/Selection/${data}`,
		method: 'get',
	}, false)
}

// 楼层系统选择
export const taskSystem = (id, floorId) => {
	return request({
		url: `/org/app/sub/plan/app/task/system/${id}/${floorId}`,
		method: 'get',
	}, false)
}


export const tasksItem = (data) => {
	return request({
		url: `/org/app/tasks/record/record/${data}`,
		method: 'get'
	})
}

// 获取设备详细
export const deviceItem = (data) => {
	return request({
		url: `/org/app/device/item/${data}`,
		method: 'get'
	})
}

// 获取设备详细
export const deviceDetail = (data) => {
	return request({
		url: `/org/app/device/${data}`,
		method: 'get'
	})
}

// 新增检查记录
export const recordAdd = (data, loading = true) => {
	return request({
		url: `/org/app/tasks/record/record`,
		method: 'post',
		data: data,
	}, loading)
}

// 获取记录列表
export const recordList = (data) => {
	return request({
		url: `/org/app/tasks/record/record/list`,
		method: 'get',
		data: data
	}, false)
}

// 获取任务列表
export const taskList = (data) => {
	return request({
		url: `/org/app/project/myTaskList`,
		method: 'get',
		data: data
	}, false)
}

// 获取任务未完成提示
export const taskIncomplete = (data) => {
	return request({
		url: `/org/app/sub/plan/app/task/incomplete/${data}`,
		method: 'get',
		data
	}, false)
}

// 查看指定类型设备的位置
export const findDevice = (data) => {
	return request({
		url: `/org/app/sub/plan/app/same/device`,
		method: 'get',
		data: data
	})
}

// 维保报告列表
export const reportList = (data) => {
	return request({
		url: `/org/app/report/list`,
		method: 'get',
		data: data
	})
}

// 生成维保报告
export const generateReport = (data) => {
	return request({
		url: `/org/app/report/generateReport/${data}`,
		method: 'post',
	})
}

// 维保报告详情
export const reportDetails = (data) => {
	return request({
		url: `/org/app/report/${data}`,
		method: 'get',
	})
}

// 检测任务是否打卡
export const isClockIn = (id) => {
	return request({
		url: `/org/app/sub/plan/app/isClockIn/${id}`,
		method: 'get'
	}, false)
}

// 检测是否在打卡范围内
export const isClockInRange = (data) => {
	return request({
		url: `/org/app/clockIn/record/check/range`,
		method: 'get',
		data
	}, false)
}

// 查询任务大厅
export const taskHall = (data) => {
	return request({
		url: `/org/app/work/order/taskHall`,
		method: 'get',
		data
	})
}

// 获取项目信息
export const projectDetail = (id) => {
	return request({
		url: `/org/app/project/${id}`,
		method: 'get'
	}, false)
}

// 查询附件
export const annexList = (id) => {
	return request({
		url: `/org/app/contract/annex/getAnnex/${id}`,
		method: 'get'
	})
}

// 审核报告
// export const reportReview = (data) => {
// 	return request({
// 		url: `/org/app/report/review`,
// 		method: 'post',
// 		data,
// 	})
// }
export const reportReview = (data) => {
	return request({
		url: `/org/app/report/approver/review`,
		method: 'post',
		data,
	})
}

// 保存报告
export const saveReport = (data) => {
	return request({
		url: `/org/app/report/saveReport`,
		method: 'post',
		data
	})
}

// 修改报告
export const updateReport = (data) => {
	return request({
		url: `/org/app/report/updateReport`,
		method: 'put',
		data
	})
}

// 设备解锁
export const unlock = (data) => {
	return request({
		url: `/org/app/sub/plan/app/device/unlock`,
		method: 'get',
		data
	})
}

// 获取签名列表
export const getSignData = (data) => {
  return request({
		url: `/org/sign/list`,
		method: 'get',
		data
	})
}

// 获取问题列表
export const getProblemData = (data) => {
  return request({
		url: `/org/app/record/problem/list`,
		method: 'get',
		data
	})
}

// 离线打卡缓存
export const offlineCache = (subPlanId, data) => {
	return request({
		url: `/org/app/sub/plan/app/task/offline/${subPlanId}`,
		method: 'get',
		data
	}, false)
}